/**
 * 2006-12-9 3:26:13
 * FTPDirectory.java
 */
package org.lilystudio.veryftp.ftp;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Samson
 * @version 0.1
 */
public class FTPDirectory {
	/** A constant indicating an FTPDirectory is a directory. ** */
	public static final int DIRECTORY_TYPE = 0;

	/** A constant indicating an FTPDirectory is a file. ** */
	public static final int FILE_TYPE = 1;

	/** A constant indicating an FTPDirectory is a symbolic link. ** */
	public static final int SYMBOLIC_LINK_TYPE = 2;

	/** A constant indicating an FTPDirectory is of unknown type. ** */
	public static final int UNKNOWN_TYPE = 3;

	private String name;

	private int type;

	private List<FTPDirectory> subDirectories = new ArrayList<FTPDirectory>();

	/**
	 * @return Returns the name.
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            The name to set.
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return Returns the subDirectories.
	 */
	public List<FTPDirectory> getSubDirectories() {
		return subDirectories;
	}

	/**
	 * @param subDirectories
	 *            The subDirectories to set.
	 */
	public void setSubDirectories(List<FTPDirectory> subDirectories) {
		this.subDirectories = subDirectories;
	}

	public void addDirectory(FTPDirectory directory) {
		subDirectories.add(directory);
	}

	public void removeDirectory(FTPDirectory directory) {
		subDirectories.remove(directory);
	}

	/**
	 * @return Returns the type.
	 */
	public int getType() {
		return type;
	}

	/**
	 * @param type
	 *            The type to set.
	 */
	public void setType(int type) {
		this.type = type;
	}

	public boolean isDirectory() {
		return (type == DIRECTORY_TYPE);
	}

	public boolean isFile() {
		return (type == FILE_TYPE);
	}

	public boolean isSymbolicLink() {
		return (type == SYMBOLIC_LINK_TYPE);
	}

	public boolean isUnknown() {
		return (type == UNKNOWN_TYPE);
	}
}
